<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="admin/head :: common_head(~{::title},~{::link},~{},~{::script})">
    <title>写博客</title>
    <link th:href="@{/css/style.css}" rel="stylesheet">
    <script th:src="@{/js/articleEdit.js}" th:inline="javascript" type="text/javascript"></script>
</head>
<body>
<header th:replace="admin/header :: common_header" class="header"></header>

<div class="d-flex align-items-stretch">
    <nav th:replace="admin/menu :: common_menu" id="sidebar"></nav>
    <div class="page-content">
        <div class="page-header">
            <div class="container-fluid">
                <h2 class="h5 no-margin-bottom">写博客</h2>
            </div>
        </div>
        <section class="no-padding-top no-padding-bottom">
            <div class="card">
                <div class="card-header" style="color: #8a8d93; font-size: 16px">创建博客</div>
                <div class="card-body">
                    <form action="editArticleSubmit" method="post" class="text-left form-validate">
                        <div class="form-group-material">
                            <input th:value="${article!=null?article.title:''}" id="title" name="title" type="text" class="form-control" placeholder="文章标题" data-msg="请输入文章标题..." required>
                        </div>
                        <div class="form-group-material">
                            <input th:value="${article!=null?article.summary:''}" id="summary" name="summary" type="text" class="form-control" placeholder="文章摘要" data-msg="请输入文章摘要..." required>
                        </div>
                        <div id="editormd">
                            <textarea th:text="${article!=null?article.content:''}" class="editormd-markdown-textarea" name="content" required></textarea>
                            <textarea class="editormd-html-textarea" name="htmlContent" required></textarea>
                        </div>
                        <div class="form-group-material">
                            <select id="type" name="type" class="form-control">
                                <option th:each="t:${types}" th:value="${t.id}" th:text="${t.name}" th:selected="${article!=null?article.type==t.id:0}"></option>
                            </select>
                        </div>
                        <div class="form-group-material">
                            <select id="classify" name="classify" class="form-control">
                                <option th:each="c:${classifys}" th:value="${c.id}" th:text="${c.name}" th:selected="${article!=null?article.classify==c.id:0}"></option>
                            </select>
                        </div>
                        <input type="hidden" name="articleId" th:value="${article!=null?article.articleId:''}">
                        <input type="hidden" name="author" th:value="${session.user.username}">
                        <div class="form-group-material col-md-3">
                            <input type="submit" value="发布博客" class="btn btn-danger">
                        </div>
                    </form>
                </div>
            </div>
        </section>
        <footer th:replace="admin/footer :: common_footer" class="footer"></footer>
    </div>
</div>
</body>
</html>